const http = require('../../utils/http');
Page({
    data: {
        publicAccountLoginUrl: '',
    },
    onLoad: function (options) {
        console.log(http.baseUrl)
        this.setData({
            openid: options.openid,
            // publicAccountLoginUrl: 'https://admin.alipayjf.com/wxopen/authorize?miniOpenid=abc' ,
            publicAccountLoginUrl: http.baseUrl+'/wxopen/authorize?miniOpenid=' + options.openid
            // webShowed: true
        })

        let interval = setInterval(function(){ isAuth(options.openid) }, 1000);

        let isAuth = function (openid) {
            http._get('/mini/isAuth?miniOpenid=' + openid).then(res => {
                if (res.code == 200) {
                    clearInterval(interval);
                    wx.navigateBack({
                        delta: 2
                    })
                }
            })
        }

    }

})
